/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.apli.haiam.ejb.entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Informática
 */
@Entity
@Table(name = "cex_nacionalidad")
@NamedQueries({
    @NamedQuery(name = "CexNacionalidad.findAll", query = "SELECT c FROM CexNacionalidad c")})
public class CexNacionalidad implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "cna_id")
    private Integer cnaId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 64)
    @Column(name = "cna_nombre")
    private String cnaNombre;
    @Column(name = "cna_codigo")
    private Integer cnaCodigo;
    @OneToMany(mappedBy = "cexNacionalidad", fetch = FetchType.LAZY)
    private List<CexHistoriaClinica> cexHistoriaClinicaList;
    @OneToMany(mappedBy = "cexNacionalidad", fetch = FetchType.LAZY)
    private List<AdmMedico> admMedicoList;

    public CexNacionalidad() {
    }

    public CexNacionalidad(Integer cnaId) {
        this.cnaId = cnaId;
    }

    public CexNacionalidad(Integer cnaId, String cnaNombre) {
        this.cnaId = cnaId;
        this.cnaNombre = cnaNombre;
    }

    public Integer getCnaId() {
        return cnaId;
    }

    public void setCnaId(Integer cnaId) {
        this.cnaId = cnaId;
    }

    public String getCnaNombre() {
        return cnaNombre;
    }

    public void setCnaNombre(String cnaNombre) {
        this.cnaNombre = cnaNombre;
    }

    public Integer getCnaCodigo() {
        return cnaCodigo;
    }

    public void setCnaCodigo(Integer cnaCodigo) {
        this.cnaCodigo = cnaCodigo;
    }

    public List<CexHistoriaClinica> getCexHistoriaClinicaList() {
        return cexHistoriaClinicaList;
    }

    public void setCexHistoriaClinicaList(List<CexHistoriaClinica> cexHistoriaClinicaList) {
        this.cexHistoriaClinicaList = cexHistoriaClinicaList;
    }

    public List<AdmMedico> getAdmMedicoList() {
        return admMedicoList;
    }

    public void setAdmMedicoList(List<AdmMedico> admMedicoList) {
        this.admMedicoList = admMedicoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cnaId != null ? cnaId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CexNacionalidad)) {
            return false;
        }
        CexNacionalidad other = (CexNacionalidad) object;
        if ((this.cnaId == null && other.cnaId != null) || (this.cnaId != null && !this.cnaId.equals(other.cnaId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.apli.haiam.ejb.entidades.CexNacionalidad[ cnaId=" + cnaId + " ]";
    }
    
}
